home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / os.355 < prev    next >
Text File  |  1992-02-06  |  6KB  |  166 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f2\fmodern Courier;}
  2. \paperw13040
  3. \paperh10200
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs24 swapdisk other than on 40\
  7.  
  8. \i \
  9.  
  10. \i0 Q: Does anyone have any experience setting up an alternative swap device?  I'm booting off the Ethernet and want to swap to a 330.  Do I just label my 330 as swapdisk?\
  11. \
  12. A:  Following is the answer, and lots of background.  The quick answer, though: yes, call it swapdisk and things (mostly) work, with only a little more to do, like modifying swaptab(5) and fstab(5).\
  13. \
  14. When the system boots up, it runs 
  15. \f2 /etc/rc
  16. \f0 , a shell script.  The 
  17. \f2 rc
  18. \f0  script (rc stands for “Run Control”) is what does “multi-user start-up.”  One thing to recognize is that in single-user land, the virtual memory system is turned off: no paging is done.  The paging system is fired up during multi-user start-up.  (Now, one might think this is a big limitation on single-user mode's usefulness.  Not really: we have a minimum 8MB of core, so without the Window Server and the Workspace Manager, there's lots of room in which to play.)\
  19. \
  20. In the “Goode Olde Dayes,” the system would (typically) page to the file\
  21. \
  22.     
  23. \f2 /private/vm/swapfile
  24. \f0 \
  25. \
  26. Typically, because it's actually configurable, in 
  27. \f2 /etc/swaptab
  28. \f0  (yes, there's a man page: section 5).  The 
  29. \f2 mach_swapon(8)
  30. \f0  command, invoked in 
  31. \f2 rc
  32. \f0 , reads 
  33. \f2 swaptab
  34. \f0  and enables paging on the specified files.  And that was that, mostly.\
  35. \
  36. Now we have the possibility of the swapdisk, which we want to use automatically.  So, another 
  37. \f2 rc
  38. \f0  script was written: 
  39. \f2 rc.swap
  40. \f0  handles the determination of whether there's a swapdisk present, and, if so, turning on paging to it.  To do this, 
  41. \f2 rc.swap
  42. \f0  looks in 
  43. \f2 /etc/fstab
  44. \f0 , trying to find a file system called 
  45. \f2 /private/swapdisk
  46. \f0  which should be mounted.  (
  47. \fs22 NOTE
  48. \fs24 : this information is 
  49. \i\fs22 NOT
  50. \i0\fs24  obtained from NetInfo!)  If it finds one, it looks at the device's label, to see if the device is called swapdisk.  If not, it ignores the disk; if so, it continues on to enable paging on that disk.  (See the 
  51. \f2 checkswap
  52. \f0 (8) command for yet more details.)\
  53. \
  54. Specifically, to enable paging, rc.swap first mounts the file system.  Then, it ensures that the file\
  55. \
  56.     
  57. \f2 /private/swapdisk/vm/swapfile
  58. \f0 \
  59. \
  60. exists, and invokes 
  61. \f2 mach_swapon
  62. \f0  to turn on paging — turning it on 
  63. \b explicitly
  64. \b0  to this file, and 
  65. \b not
  66. \b0  consulting 
  67. \f2 swaptab
  68. \f0 .  In addition, 
  69. \f2 rc.swap
  70. \f0  ensure that 
  71. \f2 /tmp 
  72. \f0 references a directory on the swapdisk.\
  73. \
  74. None of this changes what 
  75. \f2 rc
  76. \f0  itself does, though.  It still invokes 
  77. \f2 mach_swapon
  78. \f0 , just like in the Goode Olde Dayes.  This will enable paging to two files (based on the standard configuration of 
  79. \f2 swaptab
  80. \f0 ):\
  81. \
  82.     
  83. \f2 /private/swapdisk/vm/swapfile
  84. \f0 \
  85.     
  86. \f2 /private/vm/swapfile
  87. \f0 \
  88. \
  89. This might seem like A Good Thing, but it isn't.  Last we knew, there was a (minor?) bug which prevented using multiple swapfiles successfully.  (The bug is that if a mapped file spans swapfile boundaries, not-completely-predictable things can happen.  To tickle the bug, though, the primary swapfile must fill up first.)  Should be benign, really.\
  90. \
  91. So, back to the original question!  Here it is again:\
  92. \
  93.  
  94. \i Q: Does anyone have any experience setting up an alternative swap device?  I'm booting of the Ethernet and want to swap to a 330.  Do I just label my 330 as swapdisk?\
  95.  
  96. \i0 \
  97. Yes, label the 330 as 
  98. \b swapdisk
  99. \b0 , and all should be fine.  Note that everything after the first eight characters in the disk name is ignored, so swapdisk1 or swapdiskFuBar is supposed to work, too.  But, please please please don't then boot off the 330 after having used it for a swapdisk: 
  100. \f2 /tmp
  101. \f0  will be screwed up.  Remember that 
  102. \f2 rc.swap
  103. \f0  puts points 
  104. \f2 /tmp
  105. \f0  to the swapdisk?  Well, you end up with 
  106. \f2 /tmp
  107. \f0  referencing (eventually)\
  108. \
  109.     
  110. \f2 /private/swapdisk/tmp\
  111. \
  112.  
  113. \f0 (We say “eventually” because there are multiple levels of symbolic links).  So at best, a bit of mucking around, perhaps in 
  114. \f2 rc
  115. \f0 , will be needed to set things back to rights.  If you're always going to boot off the network, then\
  116. \
  117.     • rename your disk to be 
  118. \b swapdisk
  119. \b0 ;\
  120.     • be sure that 
  121. \f2 /private/swapdisk
  122. \f0  is referenced in the client partition's 
  123. \f2 fstab
  124. \f0 ;\
  125.     • to be safe, be sure that 
  126. \f2 /private/vm/swapfile
  127. \f0  is not referenced in the client\
  128.        partition's swaptab.\
  129. \
  130. A reasonable fstab entry for this would be\
  131. \
  132.  
  133. \f2\fs20     /dev/sd0a      /private/swapdisk       4.3 rw,noquota,noauto   0 1\
  134.  
  135. \f0\fs24 \
  136. And, if booting off both the network and the 330 is desired, add stuff to ensure that 
  137. \f2 /tmp
  138. \f0  is always a valid reference (perhaps adding this to rc.swap would be reasonable: if no swapdisk is present, ensure that 
  139. \f2 /tmp
  140. \f0  references 
  141. \f2 /private/tmp
  142. \f0 , and that 
  143. \f2 /private/tmp
  144. \f0  is a real directory, not a link to, for example, 
  145. \f2 /private/swapdisk/tmp
  146. \f0 ).\
  147. \
  148. Incidentally, one 
  149. \fs22 CAN
  150. \fs24  use a swapdisk in conjunction with booting off a 
  151. \fs22 SCSI
  152. \fs24 .  Just connect up an outboard disk, name it swapdisk, ensure there's a file system on it, and put the device in 
  153. \f2 fstab
  154. \f0 , using a line like that above but specifying 
  155. \f2 /dev/sd1a
  156. \f0  instead of 
  157. \f2 /dev/sd0a
  158. \f0 , for example.\
  159. \
  160. QA355\
  161. \
  162. Valid for 1.0 \
  163. Valid for 2.0\
  164. \
  165.  
  166.